home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: schwarz@mips.complang.tuwien.ac.at (Konrad Schwarz)
- Newsgroups: comp.lang.c,comp.lang.c.moderated
- Subject: Re: C coding problem
- Date: 10 Apr 1996 07:11:59 -0500
- Organization: TU Wien
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4kg8if$ijs@solutions.solon.com>
- References: <4j06na$808@solutions.solon.com> <4k1qh3$5hn@solutions.solon.com> <4k5vrk$a2d@solutions.solon.com> <4kbdq6$ec2@solutions.solon.com> <4kcmji$p13@solutions.solon.com>
- NNTP-Posting-Host: solutions.solon.com
-
- In article <4kcmji$p13@solutions.solon.com>,
- Chris Torek <torek@elf.bsdi.com> writes:
-
- |> /* prototype bcopy, for turning into assembly... */
-
- |> n = (int)src ^ (int)dst;
- |> if ((int)dst & 1)
- |> *dst++ = *src++, len--;
- |> if ((n & 7) == 0) {
-
- Did you separate assignment and use of n to fill a delay slot?
- (You use n to test maximal alignment. If (dst, src) allows a certain
- alignment, I believe (dst + 1, src + 1) allow exactly the same alignment.)
-
- |> n = len / 8 / 8;
-
- Why don't you use len >> 6?
-
- |> /* Handle any trailing `long long's. */
-
- Does Duff's device buy you anything?
-
- |> /*
- |> * Cannot even int-align, but still have at least 7 bytes to copy,
- |> * and dst is at least short-aligned. Copy up to two more bytes
- |> * to make it int-aligned, leaving at least 5 bytes to go. This
- |> * will leave src unaligned with a 1, 2, or 3-byte offset.
-
- I presume your not using (aligned) 2 byte moves reflects a weakness in the
- SPARCs you used. Otherwise, you could fold the the 3-byte offset case into
- the 1-byte offset case.
-
- Konrad Schwarz
-